<template>
    <div class="dialog">
        <el-dialog title="作业信息" :visible.sync="showDialog" width="30%" top="0" :close-on-click-modal="false" @close="cancel">
            <el-form ref="ruleForm" label-position="left" label-width="180" :model="formData" :rules="rules" class="el-form">
                <el-form-item label="作业名称">
                    <el-row :gutter="10">
                        <el-col :span="12">
                            <el-input></el-input>
                        </el-col>
                        <el-col :span="12">
                            <el-input></el-input>
                        </el-col>
                    </el-row>
                </el-form-item>
                <el-form-item label=" ">
                    <el-row :gutter="10">
                        <el-col :span="12">
                            <el-input></el-input>
                        </el-col>
                        <el-col :span="12">
                            <el-input></el-input>
                        </el-col>
                    </el-row>
                </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button class="cancelbtn" @click="cancel()">取 消</el-button>
                <el-button type="primary" class="savebtn" @click="save('ruleForm')">保 存</el-button>
            </div>
        </el-dialog>
    </div>
</template>

<script>
export default {
    name: "addeditdialog",
    components: {},
    props: {
        // 弹框名称
        titleText: {
            type: String,
            default: "",
        },
        show: {
            type: Boolean,
            default: false,
        },
    },
    data() {
        return {
            showDialog: this.show,
            // 展示
            formData: {
                img: "",
                equipmentName: "",
                operationMode: "",
            },
            pictureList: [],
            options: [
                {
                    value: "选项1",
                    label: "黄金糕",
                },
                {
                    value: "选项2",
                    label: "双皮奶",
                },
            ],
            devs: ["测试1", "测试2"],
            rules: {
                equipmentName: [
                    {
                        required: true,
                        message: "请输入报告图片",
                        trigger: ["change", "blur"],
                    },
                ],
                equipmentName1: [
                    {
                        required: true,
                        message: "请输入上传人",
                        trigger: ["change", "input", "blur"],
                    },
                ],
                equipmentName3: [
                    {
                        required: true,
                        message: "请输入上传时间",
                        trigger: ["change", "blur"],
                    },
                ],
            },
        };
    },

    watch: {
        show(v) {
            this.showDialog = v;
        },
    },
    created() {},
    mounted() {},
    methods: {
        add() {
            this.devs.push("测试3");
        },
        save(formData) {
            this.$refs[formData].validate((valid) => {
                if (valid) {
                    console.log(this.formData);
                }
            });
        },
        close() {
            this.$emit("closeDialog");
        },
        cancel() {
            this.$emit("closeDialog");
            this.formData = {};
        },
    },
};
</script>

<style lang="scss" scoped>
</style>
